package org.nepu.srr.设备设施资料.钻井装置基本资料;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;
import org.nepu.sc.domain.DataVO;


@Data
public class B4cDrillingDeviceParams {
    @ApiModelProperty(value = "设备清单(有/无)")
    DataVO deviceList;

    @ApiModelProperty(value = "应急计划（包括溢油应急计划）(有/无)")
    DataVO emergencyPlan;

    @ApiModelProperty("应急部署表")
    CommonIn emergencyDeploymentTable;

    @ApiModelProperty("安全、消防、救生设施布置图")
    CommonIn safetyFacilityLayout;

    @ApiModelProperty("危险区划分")
    CommonIn dangerAreaDivision;

    @ApiModelProperty("逃生路线图")
    CommonIn escapeRouteMap;

    @ApiModelProperty("救生艇岗位人员一览表")
    CommonIn emergencyPersonnelList;

    @ApiModelProperty("危险品存放区域图")
    CommonIn dangerGoodsStorageAreaMap;

    @ApiModelProperty(value = "平台总体布置图(已全面张贴/未张贴)")
    DataVO platformLayoutMap;

    @ApiModelProperty(value = "平台图纸资料(保存完好/破损/丢失)")
    DataVO platformMapDocument;

    public B4cDrillingDeviceResult rate(){
        double fullScore = 85;
        double score = 0;
        if(deviceList.getData().equals("合格")){
            score += 5;
        }
        if(emergencyPlan.getData().equals("合格")){
            score += 10;
        }
        if(CommonMethods.isAllTrue(emergencyDeploymentTable.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(safetyFacilityLayout.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(dangerAreaDivision.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(escapeRouteMap.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(emergencyPersonnelList.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(dangerGoodsStorageAreaMap.getInput())){
            score += 5;
        }
        if(platformLayoutMap.getData().equals("合格")){
            score += 10;
        }
        if(platformMapDocument.getData().equals("合格")){
            score += 5;
        }
        double rate = score/fullScore;
        B4cDrillingDeviceResult result = new B4cDrillingDeviceResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
